home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!xmission!news
- From: tknarr@xmission.com ( Todd Knarr )
- Newsgroups: comp.lang.c++
- Subject: Re: deque container - how to implement?
- Date: 12 Jan 1996 01:06:43 GMT
- Organization: Chaos Central
- Message-ID: <4d4c73$qmr@news.xmission.com>
- References: <4cvepv$5rn@news.xmission.com> <4d1of1$kj7@rap.SanDiegoCA.ATTGIS.COM>
- Reply-To: tknarr@xmission.com ( Todd Knarr )
- NNTP-Posting-Host: slc5.xmission.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4d1of1$kj7@rap.SanDiegoCA.ATTGIS.COM>, jbc@ElSegundoCA.ATTGIS.COM (Jim Chapman) writes:
- >In STL, deque<T> is supposed to support random access in constant time, so
- >a linked list implemention wouldn't do. The first poster was closer to
- >the mark.
-
- If you want constant-time access, an array is the only way to implement
- it. Unfortunately then your insert time can skyrocket unexpectedly when
- you have to copy the entire pointer array to a bigger array. It can also
- fail completely if you can't allocate the bigger array ( the non-intrusive
- linked-list form can also fail like that, it's just less likely because of
- the smaller blocks of memory involved ). It's a trade-off between the
- operations needed, memory space used, access time and insert time.
-
- --
- Todd Knarr : tknarr@xmission.com | finger for PGP public key
- | Member, USENET Cabal
-
- Seriously, I don't want to die just yet. I don't care how
- good-looking they are, I! don't! want! to! die!"
- -- Megazone ( UF1 )
-
-